﻿<UserControl xmlns:PageBar="clr-namespace:Mengsk.ProxyDelivery.App.UI.PageBar"  x:Class="Mengsk.ProxyDelivery.App.UI.Service.InvicationCodeUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
              xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
             d:DesignHeight="300" d:DesignWidth="1000">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0" Orientation="Horizontal">
            <TextBlock Text="卖家编号:" Margin="3" VerticalAlignment="Center" />
            <TextBox Name="tbSellerId" Margin="3" VerticalAlignment="Center" Width="100"/>
            <TextBlock Text="邀请码:" Margin="3" VerticalAlignment="Center" />
            <TextBox Name="tbCode" Margin="3" VerticalAlignment="Center" Width="200"/>
            <TextBlock Text="创建时间:" Margin="3" VerticalAlignment="Center" />
            <xctk:DateTimePicker Name="dpStart" Margin="3" VerticalAlignment="Center" Width="150" xctk:Format="Custom" xctk:TimeFormatString="yyyy-MM-dd HH:mm:ss" />
            <TextBlock Text="到:" Margin="3" VerticalAlignment="Center" />
            <xctk:DateTimePicker Name="dpEnd" Margin="3" VerticalAlignment="Center" Width="150" xctk:Format="Custom" xctk:TimeFormatString="yyyy-MM-dd HH:mm:ss" />
            <Button Name="btnQuery" Content="查询" Margin="3" VerticalAlignment="Center" Width="60" Click="btnQuery_Click"/>
        </StackPanel>

        <ListBox Grid.Row="1" Name="lstItems">
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="Margin" Value="1,0,1,6"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <GroupBox Padding="0" Margin="0">
                                    <GroupBox.Header>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="100"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="150"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>

                                            <TextBlock Grid.Column="0" Text="创建卖家:" Margin="3" VerticalAlignment="Center"/>
                                            <TextBox Grid.Column="1" Text="{Binding Source.SellerId}" Margin="3" VerticalAlignment="Center" Style="{StaticResource SelectableTextBox}"/>

                                            <TextBlock Grid.Column="2" Text="创建时间:" Margin="3" VerticalAlignment="Center"/>
                                            <TextBox Grid.Column="3" Text="{Binding Source.CreateTime,Converter={StaticResource datetimeConverter}}" Margin="3" VerticalAlignment="Center" Style="{StaticResource SelectableTextBox}"/>

                                            <TextBlock Grid.Column="4" Text="邀请码:" Margin="3" VerticalAlignment="Center"/>
                                            <TextBox Grid.Column="5" Text="{Binding Source.Code}" Margin="3" VerticalAlignment="Center" Style="{StaticResource SelectableTextBox}"/>
                                        </Grid>
                                    </GroupBox.Header>

                                    <DataGrid ItemsSource="{Binding Sellers}" AutoGenerateColumns="False" GridLinesVisibility="All" SelectionMode="Extended" SelectionUnit="FullRow" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False">
                                        <DataGrid.Columns>
                                            <DataGridTextColumn Header="卖家编号" Binding="{Binding Id}"/>
                                            <DataGridTextColumn Header="创建时间" Binding="{Binding CreateTime,Converter={StaticResource datetimeConverter}}"/>
                                            <DataGridTextColumn Header="卖家邮箱" Binding="{Binding Mail}"/>
                                        </DataGrid.Columns>
                                    </DataGrid>



                                </GroupBox>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ListBox.ItemContainerStyle>
        </ListBox>


        <PageBar:PageBarUserControl x:Name="pbBar" Grid.Row="2" PageSize="50" PageChanging="PageBarUserControl_PageChanging" />
    </Grid>
</UserControl>
